import { getIndexPageData } from "../../../api.js"
Page({
  data: {

  },
  onLoad: function (options) {
    if (options.order) {
      this.setData({
        order: JSON.parse(options.order)
      })

    }
    this.getRecommendProduct()
  },
  // 获取推荐商品
  getRecommendProduct() {
    let businessId = getApp().globalData.businessId
    getIndexPageData(businessId).then(res => {
      if (res.data.code === 666) {
        this.setData({
          products: res.data.data.consignment_data
        })
      }
    })
  },
  onShow() {
    getApp().startpage(new Date().getTime())
  },
  onHide() {
    getApp().endpage(new Date().getTime())
  },
  goindex() {
    wx.switchTab({
      url: '/pages/tabBar/index/index',
    })
    getApp().endpage(new Date().getTime())
  }
})